rem
rem FLIP filter
rem 

proc filter%:(in%,planes%)

local w%,h%,out%,i%,m%

	dinit "Flip"
	dchoice m%,tx$:(95),tx$:(98) : rem "Direction" "horizontal,vertical"
	if dialog = 0 : return : endif
	busy tx$:(72),1,1 			: rem "busy"
	
	gUse in%
	w% = gWidth
	h% = gHeight

	out% = gCreate(0,0,w%,h%,0,planes%-1) : rem create output window

	gGrey planes% and 2 : rem set grey mode

	if m% = 1
		while i% < w%
			gAt w%-i%-1,0
			gCopy in%,i%,0,1,h%,3 : rem copy column by column
			i% = i%+1
		endwh
	else
		while i% < h%
			gAt 0,h%-i%-1
			gCopy in%,0,i%,w%,1,3 : rem copy line by line
			i% = i%+1
		endwh
	endif

	return out% : rem return handle of output drawable

endp


